<template>
	<view class="shipped">
		<view>
			<view class="topItem">
				<view class="left">
					<image :src="data.httpUrl+'/app/file/viewFile?fileId='+item.storeLogo" mode="aspectFill"></image>
					{{item.storeName}}
					<text v-if="item.refundCount>0" style="color:red">(售后中)</text>

				</view>
				<view class="right">
					待发货
				</view>
			</view>
			<view>

			</view>
			<Item v-for="(item1,index1) in item.productDTOS" :key="index1" :item="item1" />
		</view>
		<view class="bot">
			<text  class="lxsj" @tap.stop="contactMerchant(item)">联系商家</text>
			<text v-if="item.sendType?.value=='SELF'" @tap.stop="handeClick(item)">扫码核销</text>
			<text  v-if="(item.freeOrderFlag.value == 'Y' || item.joinFlag)" class="splicingOrders"
				@tap.stop="handeClickFree(item)">{{item.joinFlag?'分享':'发起免单助力'}}</text>
		</view>
	</view>

</template>

<script setup lang="ts">
	//待发货
	import Item from './item'
	import { reactive } from 'vue';
	const props = defineProps(['item'])
	const emit = defineEmits(['handeFree','share'])
	const data = reactive<any>({
		httpUrl: getApp().globalData.baseUrl,
		obj: { shareType: 'ALL' }
	})
	console.log(props.isFree,'isFree')
	const contactMerchant = (item) => {
		const conversationID = `C2C${item.sellUserId}`;
		uni.navigateTo({ url: `/pages/TUIKit/components/TUIChat/index?conversationID=${conversationID}&userId=${item.sellUserId}&trendsId=${item.sonOrderNo}&areaType=order` });
	}
	const handeClick = ({ verifyCode }) => {
		uni.navigateTo({
			url: '/pages/writeOff/index?code=' + verifyCode
		})
	}

	const handeClickFree = (item) => {
		if (item.joinFlag) {
			emit('share',item.sonOrderNo)
			// uni.navigateTo({
			// 	url: '/pages/myFreeInteraction/index?type=MY'
			// })
			return;
		}
		emit('handeFree', item)
	}
</script>

<style lang="scss">
	.shipped {
		>.bot1 {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 24rpx;
			color: #8C8C8C;
			margin-top: 25rpx;

			view {
				font-size: 24rpx;

				text {
					font-size: 36rpx;
					color: #6B64D3;
				}
			}
		}

		>.bot {
			margin-top: 33rpx;
			display: flex;
			align-items: flex-end;
			justify-content: flex-end;

			text {
				padding: 11rpx 24rpx;
				border-radius: 100rpx;
			}

			text:nth-of-type(1) {
				border: 2rpx solid #D9D9D9;
				margin-right: 16rpx;
			}

			text:nth-of-type(2) {
				color: #6B64D3;
				border: 2rpx solid #6B64D3;
				margin-right: 16rpx;
			}
		}

		.topItem {
			display: flex;
			align-items: center;
			justify-content: space-between;

			.left {
				display: flex;
				align-items: center;
				font-size: 32rpx;

				image {
					width: 48rpx;
					height: 48rpx;
					border-radius: 50%;
					margin-right: 16rpx;
				}

				.lxsj {
					padding: 5rpx 10rpx;
					border-radius: 100rpx;
					border: 2rpx solid #D9D9D9;
					margin-left: 10rpx;
				}
			}

			.right {
				color: #FF8C00;
			}
		}
	}

	.splicingOrders {
		color: #fff!important;
		border-color: #FF263F !important;
		background-color: #FF263F;
	}
</style>